home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / mike40c.arc / PUTSC.ASM < prev    next >
Assembly Source File  |  1986-10-23  |  4KB  |  89 lines

  1. page ,132
  2.             title    putsc.asm - no snow screen update routine
  3.  
  4. ;****************************************************************
  5. ;* No-snow screen display routine                               *
  6. ;*  This routine moves screen data from a user buffer to the    *
  7. ;*  screen buffer during horizontal retrace time, resulting in  *
  8. ;*  no screen flicker.                                          *
  9. ;*                                                              *
  10. ;* definition:                                                  *
  11. ;*    void putsc (char *,int,int,int);                          *
  12. ;*      char * buffer       /* data, attribute buffer           *
  13. ;*      int start_of_buff   /* row*80 + col                     *
  14. ;*      int length          /* # of col                         *
  15. ;*      int page            /* video page                       *
  16. ;*                                                              *
  17. ;* note: designed for use with Microsoft 'C' (4.0)              *
  18. ;*                                                              *
  19. ;* edit date: 07/15/85              by Mike Elkins              *
  20. ;****************************************************************
  21.  
  22. _text       segment    byte public 'code'
  23.         assume    cs:_text
  24.  
  25.         public    _putsc
  26. _putsc        proc    near        ;far
  27.  
  28. ; buffer = +6    +4 from each if near
  29. ; offset = +10   +6 for near
  30. ; length = +12   +8 for near
  31. ; page = +14     +10 for near
  32.  
  33.                 push    bp            ;save calling environment
  34.                 mov    bp,sp
  35.                 push    si
  36.                 push    di
  37.                 push    ds
  38.  
  39.           mov    ah,15            ;get current mode
  40.            int    10h            ;system video
  41.               mov    dx,3BAh            ;monochrome port address
  42.                 mov     di,[bp+6]               ;offset for buffer
  43.                 add     di,di                   ;correct for attribute bytes
  44.            cmp    al,7            ;is b/w?
  45.             je    movmno                  ;skip pages for mono
  46.                 mov     dx,3DAh                 ;color port
  47.                 mov     ax,0B800h
  48.                 mov     bx,[bp+10]              ;get page
  49.                 cmp     bx,0
  50.                 je      mov001                  ;page 0
  51.                 mov     ax,0B900h
  52.                 cmp     bx,1
  53.                 je      mov001                  ;page 1
  54.                 mov     ax,0BA00h
  55.                 cmp     bx,2
  56.                 je      mov001                  ;page 2
  57.                 mov     ax,0BB00h               ;page 3
  58.                 jmp     mov001
  59.  
  60. movmno:         mov     ax,0B000h                ;set for mono address
  61. mov001:         mov     es,ax
  62.  
  63. ;far            lds     si,[bp+6]        ;source buffer pointer
  64.                 mov     si,[bp+4]        ;source buffer pointer
  65.                 mov     cx,[bp+8]        ;block length
  66.  
  67. mov002:
  68.                 in      al,dx            ;screen status
  69.                 test    al,1             ;is 'high'?
  70.                 jnz     mov002           ;yes - wait
  71. mov004:         in      al,dx            ;screen status
  72.                 test    al,1             ;is 'low'?
  73.                 jz      mov004           ;yes - wait
  74.                 movsw                    ;mov bytes to screen
  75.                 loop    mov002
  76.  
  77.                 pop    ds
  78.                 pop    di
  79.                 pop    si
  80.                 pop    bp
  81.                 ret
  82.  
  83. _putsc          endp
  84.  
  85. _text           ends
  86.  
  87.                 end
  88. 
  89.